\(\int (d+e x) (a+b \log (c x^n))^2 \, dx\) [78]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [B] (verification not implemented)
   Sympy [A] (verification not implemented)
   Maxima [A] (verification not implemented)
   Giac [B] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 18, antiderivative size = 101 \[ \int (d+e x) \left (a+b \log \left (c x^n\right )\right )^2 \, dx=-2 a b d n x+2 b^2 d n^2 x+\frac {1}{4} b^2 e n^2 x^2-2 b^2 d n x \log \left (c x^n\right )-\frac {1}{2} b e n x^2 \left (a+b \log \left (c x^n\right )\right )+d x \left (a+b \log \left (c x^n\right )\right )^2+\frac {1}{2} e x^2 \left (a+b \log \left (c x^n\right )\right )^2 \]

[Out]

-2*a*b*d*n*x+2*b^2*d*n^2*x+1/4*b^2*e*n^2*x^2-2*b^2*d*n*x*ln(c*x^n)-1/2*b*e*n*x^2*(a+b*ln(c*x^n))+d*x*(a+b*ln(c
*x^n))^2+1/2*e*x^2*(a+b*ln(c*x^n))^2

Rubi [A] (verified)

Time = 0.05 (sec) , antiderivative size = 101, normalized size of antiderivative = 1.00, number of steps used = 7, number of rules used = 5, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.278, Rules used = {2367, 2333, 2332, 2342, 2341} \[ \int (d+e x) \left (a+b \log \left (c x^n\right )\right )^2 \, dx=d x \left (a+b \log \left (c x^n\right )\right )^2-\frac {1}{2} b e n x^2 \left (a+b \log \left (c x^n\right )\right )+\frac {1}{2} e x^2 \left (a+b \log \left (c x^n\right )\right )^2-2 a b d n x-2 b^2 d n x \log \left (c x^n\right )+2 b^2 d n^2 x+\frac {1}{4} b^2 e n^2 x^2 \]

[In]

Int[(d + e*x)*(a + b*Log[c*x^n])^2,x]

[Out]

-2*a*b*d*n*x + 2*b^2*d*n^2*x + (b^2*e*n^2*x^2)/4 - 2*b^2*d*n*x*Log[c*x^n] - (b*e*n*x^2*(a + b*Log[c*x^n]))/2 +
 d*x*(a + b*Log[c*x^n])^2 + (e*x^2*(a + b*Log[c*x^n])^2)/2

Rule 2332

Int[Log[(c_.)*(x_)^(n_.)], x_Symbol] :> Simp[x*Log[c*x^n], x] - Simp[n*x, x] /; FreeQ[{c, n}, x]

Rule 2333

Int[((a_.) + Log[(c_.)*(x_)^(n_.)]*(b_.))^(p_.), x_Symbol] :> Simp[x*(a + b*Log[c*x^n])^p, x] - Dist[b*n*p, In
t[(a + b*Log[c*x^n])^(p - 1), x], x] /; FreeQ[{a, b, c, n}, x] && GtQ[p, 0] && IntegerQ[2*p]

Rule 2341

Int[((a_.) + Log[(c_.)*(x_)^(n_.)]*(b_.))*((d_.)*(x_))^(m_.), x_Symbol] :> Simp[(d*x)^(m + 1)*((a + b*Log[c*x^
n])/(d*(m + 1))), x] - Simp[b*n*((d*x)^(m + 1)/(d*(m + 1)^2)), x] /; FreeQ[{a, b, c, d, m, n}, x] && NeQ[m, -1
]

Rule 2342

Int[((a_.) + Log[(c_.)*(x_)^(n_.)]*(b_.))^(p_.)*((d_.)*(x_))^(m_.), x_Symbol] :> Simp[(d*x)^(m + 1)*((a + b*Lo
g[c*x^n])^p/(d*(m + 1))), x] - Dist[b*n*(p/(m + 1)), Int[(d*x)^m*(a + b*Log[c*x^n])^(p - 1), x], x] /; FreeQ[{
a, b, c, d, m, n}, x] && NeQ[m, -1] && GtQ[p, 0]

Rule 2367

Int[((a_.) + Log[(c_.)*(x_)^(n_.)]*(b_.))^(p_.)*((d_) + (e_.)*(x_)^(r_.))^(q_.), x_Symbol] :> With[{u = Expand
Integrand[(a + b*Log[c*x^n])^p, (d + e*x^r)^q, x]}, Int[u, x] /; SumQ[u]] /; FreeQ[{a, b, c, d, e, n, p, q, r}
, x] && IntegerQ[q] && (GtQ[q, 0] || (IGtQ[p, 0] && IntegerQ[r]))

Rubi steps \begin{align*} \text {integral}& = \int \left (d \left (a+b \log \left (c x^n\right )\right )^2+e x \left (a+b \log \left (c x^n\right )\right )^2\right ) \, dx \\ & = d \int \left (a+b \log \left (c x^n\right )\right )^2 \, dx+e \int x \left (a+b \log \left (c x^n\right )\right )^2 \, dx \\ & = d x \left (a+b \log \left (c x^n\right )\right )^2+\frac {1}{2} e x^2 \left (a+b \log \left (c x^n\right )\right )^2-(2 b d n) \int \left (a+b \log \left (c x^n\right )\right ) \, dx-(b e n) \int x \left (a+b \log \left (c x^n\right )\right ) \, dx \\ & = -2 a b d n x+\frac {1}{4} b^2 e n^2 x^2-\frac {1}{2} b e n x^2 \left (a+b \log \left (c x^n\right )\right )+d x \left (a+b \log \left (c x^n\right )\right )^2+\frac {1}{2} e x^2 \left (a+b \log \left (c x^n\right )\right )^2-\left (2 b^2 d n\right ) \int \log \left (c x^n\right ) \, dx \\ & = -2 a b d n x+2 b^2 d n^2 x+\frac {1}{4} b^2 e n^2 x^2-2 b^2 d n x \log \left (c x^n\right )-\frac {1}{2} b e n x^2 \left (a+b \log \left (c x^n\right )\right )+d x \left (a+b \log \left (c x^n\right )\right )^2+\frac {1}{2} e x^2 \left (a+b \log \left (c x^n\right )\right )^2 \\ \end{align*}

Mathematica [A] (verified)

Time = 0.03 (sec) , antiderivative size = 77, normalized size of antiderivative = 0.76 \[ \int (d+e x) \left (a+b \log \left (c x^n\right )\right )^2 \, dx=\frac {1}{4} x \left (b e n x \left (-2 a+b n-2 b \log \left (c x^n\right )\right )+4 d \left (a+b \log \left (c x^n\right )\right )^2+2 e x \left (a+b \log \left (c x^n\right )\right )^2-8 b d n \left (a-b n+b \log \left (c x^n\right )\right )\right ) \]

[In]

Integrate[(d + e*x)*(a + b*Log[c*x^n])^2,x]

[Out]

(x*(b*e*n*x*(-2*a + b*n - 2*b*Log[c*x^n]) + 4*d*(a + b*Log[c*x^n])^2 + 2*e*x*(a + b*Log[c*x^n])^2 - 8*b*d*n*(a
 - b*n + b*Log[c*x^n])))/4

Maple [A] (verified)

Time = 0.18 (sec) , antiderivative size = 141, normalized size of antiderivative = 1.40

method result size
parallelrisch \(\frac {b^{2} \ln \left (c \,x^{n}\right )^{2} e \,x^{2}}{2}-\frac {\ln \left (c \,x^{n}\right ) x^{2} b^{2} n e}{2}+\frac {b^{2} e \,n^{2} x^{2}}{4}+a b \ln \left (c \,x^{n}\right ) e \,x^{2}-\frac {b n a e \,x^{2}}{2}+x \,b^{2} \ln \left (c \,x^{n}\right )^{2} d -2 b^{2} d n x \ln \left (c \,x^{n}\right )+2 b^{2} d \,n^{2} x +\frac {a^{2} e \,x^{2}}{2}+2 x a b \ln \left (c \,x^{n}\right ) d -2 a b d n x +a^{2} d x\) \(141\)
risch \(\text {Expression too large to display}\) \(1545\)

[In]

int((e*x+d)*(a+b*ln(c*x^n))^2,x,method=_RETURNVERBOSE)

[Out]

1/2*b^2*ln(c*x^n)^2*e*x^2-1/2*ln(c*x^n)*x^2*b^2*n*e+1/4*b^2*e*n^2*x^2+a*b*ln(c*x^n)*e*x^2-1/2*b*n*a*e*x^2+x*b^
2*ln(c*x^n)^2*d-2*b^2*d*n*x*ln(c*x^n)+2*b^2*d*n^2*x+1/2*a^2*e*x^2+2*x*a*b*ln(c*x^n)*d-2*a*b*d*n*x+a^2*d*x

Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 200 vs. \(2 (95) = 190\).

Time = 0.28 (sec) , antiderivative size = 200, normalized size of antiderivative = 1.98 \[ \int (d+e x) \left (a+b \log \left (c x^n\right )\right )^2 \, dx=\frac {1}{4} \, {\left (b^{2} e n^{2} - 2 \, a b e n + 2 \, a^{2} e\right )} x^{2} + \frac {1}{2} \, {\left (b^{2} e x^{2} + 2 \, b^{2} d x\right )} \log \left (c\right )^{2} + \frac {1}{2} \, {\left (b^{2} e n^{2} x^{2} + 2 \, b^{2} d n^{2} x\right )} \log \left (x\right )^{2} + {\left (2 \, b^{2} d n^{2} - 2 \, a b d n + a^{2} d\right )} x - \frac {1}{2} \, {\left ({\left (b^{2} e n - 2 \, a b e\right )} x^{2} + 4 \, {\left (b^{2} d n - a b d\right )} x\right )} \log \left (c\right ) - \frac {1}{2} \, {\left ({\left (b^{2} e n^{2} - 2 \, a b e n\right )} x^{2} + 4 \, {\left (b^{2} d n^{2} - a b d n\right )} x - 2 \, {\left (b^{2} e n x^{2} + 2 \, b^{2} d n x\right )} \log \left (c\right )\right )} \log \left (x\right ) \]

[In]

integrate((e*x+d)*(a+b*log(c*x^n))^2,x, algorithm="fricas")

[Out]

1/4*(b^2*e*n^2 - 2*a*b*e*n + 2*a^2*e)*x^2 + 1/2*(b^2*e*x^2 + 2*b^2*d*x)*log(c)^2 + 1/2*(b^2*e*n^2*x^2 + 2*b^2*
d*n^2*x)*log(x)^2 + (2*b^2*d*n^2 - 2*a*b*d*n + a^2*d)*x - 1/2*((b^2*e*n - 2*a*b*e)*x^2 + 4*(b^2*d*n - a*b*d)*x
)*log(c) - 1/2*((b^2*e*n^2 - 2*a*b*e*n)*x^2 + 4*(b^2*d*n^2 - a*b*d*n)*x - 2*(b^2*e*n*x^2 + 2*b^2*d*n*x)*log(c)
)*log(x)

Sympy [A] (verification not implemented)

Time = 0.19 (sec) , antiderivative size = 163, normalized size of antiderivative = 1.61 \[ \int (d+e x) \left (a+b \log \left (c x^n\right )\right )^2 \, dx=a^{2} d x + \frac {a^{2} e x^{2}}{2} - 2 a b d n x + 2 a b d x \log {\left (c x^{n} \right )} - \frac {a b e n x^{2}}{2} + a b e x^{2} \log {\left (c x^{n} \right )} + 2 b^{2} d n^{2} x - 2 b^{2} d n x \log {\left (c x^{n} \right )} + b^{2} d x \log {\left (c x^{n} \right )}^{2} + \frac {b^{2} e n^{2} x^{2}}{4} - \frac {b^{2} e n x^{2} \log {\left (c x^{n} \right )}}{2} + \frac {b^{2} e x^{2} \log {\left (c x^{n} \right )}^{2}}{2} \]

[In]

integrate((e*x+d)*(a+b*ln(c*x**n))**2,x)

[Out]

a**2*d*x + a**2*e*x**2/2 - 2*a*b*d*n*x + 2*a*b*d*x*log(c*x**n) - a*b*e*n*x**2/2 + a*b*e*x**2*log(c*x**n) + 2*b
**2*d*n**2*x - 2*b**2*d*n*x*log(c*x**n) + b**2*d*x*log(c*x**n)**2 + b**2*e*n**2*x**2/4 - b**2*e*n*x**2*log(c*x
**n)/2 + b**2*e*x**2*log(c*x**n)**2/2

Maxima [A] (verification not implemented)

none

Time = 0.22 (sec) , antiderivative size = 136, normalized size of antiderivative = 1.35 \[ \int (d+e x) \left (a+b \log \left (c x^n\right )\right )^2 \, dx=\frac {1}{2} \, b^{2} e x^{2} \log \left (c x^{n}\right )^{2} - \frac {1}{2} \, a b e n x^{2} + a b e x^{2} \log \left (c x^{n}\right ) + b^{2} d x \log \left (c x^{n}\right )^{2} - 2 \, a b d n x + \frac {1}{2} \, a^{2} e x^{2} + 2 \, a b d x \log \left (c x^{n}\right ) + 2 \, {\left (n^{2} x - n x \log \left (c x^{n}\right )\right )} b^{2} d + \frac {1}{4} \, {\left (n^{2} x^{2} - 2 \, n x^{2} \log \left (c x^{n}\right )\right )} b^{2} e + a^{2} d x \]

[In]

integrate((e*x+d)*(a+b*log(c*x^n))^2,x, algorithm="maxima")

[Out]

1/2*b^2*e*x^2*log(c*x^n)^2 - 1/2*a*b*e*n*x^2 + a*b*e*x^2*log(c*x^n) + b^2*d*x*log(c*x^n)^2 - 2*a*b*d*n*x + 1/2
*a^2*e*x^2 + 2*a*b*d*x*log(c*x^n) + 2*(n^2*x - n*x*log(c*x^n))*b^2*d + 1/4*(n^2*x^2 - 2*n*x^2*log(c*x^n))*b^2*
e + a^2*d*x

Giac [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 215 vs. \(2 (95) = 190\).

Time = 0.34 (sec) , antiderivative size = 215, normalized size of antiderivative = 2.13 \[ \int (d+e x) \left (a+b \log \left (c x^n\right )\right )^2 \, dx=\frac {1}{2} \, b^{2} e n^{2} x^{2} \log \left (x\right )^{2} - \frac {1}{2} \, b^{2} e n^{2} x^{2} \log \left (x\right ) + b^{2} e n x^{2} \log \left (c\right ) \log \left (x\right ) + b^{2} d n^{2} x \log \left (x\right )^{2} + \frac {1}{4} \, b^{2} e n^{2} x^{2} - \frac {1}{2} \, b^{2} e n x^{2} \log \left (c\right ) + \frac {1}{2} \, b^{2} e x^{2} \log \left (c\right )^{2} - 2 \, b^{2} d n^{2} x \log \left (x\right ) + a b e n x^{2} \log \left (x\right ) + 2 \, b^{2} d n x \log \left (c\right ) \log \left (x\right ) + 2 \, b^{2} d n^{2} x - \frac {1}{2} \, a b e n x^{2} - 2 \, b^{2} d n x \log \left (c\right ) + a b e x^{2} \log \left (c\right ) + b^{2} d x \log \left (c\right )^{2} + 2 \, a b d n x \log \left (x\right ) - 2 \, a b d n x + \frac {1}{2} \, a^{2} e x^{2} + 2 \, a b d x \log \left (c\right ) + a^{2} d x \]

[In]

integrate((e*x+d)*(a+b*log(c*x^n))^2,x, algorithm="giac")

[Out]

1/2*b^2*e*n^2*x^2*log(x)^2 - 1/2*b^2*e*n^2*x^2*log(x) + b^2*e*n*x^2*log(c)*log(x) + b^2*d*n^2*x*log(x)^2 + 1/4
*b^2*e*n^2*x^2 - 1/2*b^2*e*n*x^2*log(c) + 1/2*b^2*e*x^2*log(c)^2 - 2*b^2*d*n^2*x*log(x) + a*b*e*n*x^2*log(x) +
 2*b^2*d*n*x*log(c)*log(x) + 2*b^2*d*n^2*x - 1/2*a*b*e*n*x^2 - 2*b^2*d*n*x*log(c) + a*b*e*x^2*log(c) + b^2*d*x
*log(c)^2 + 2*a*b*d*n*x*log(x) - 2*a*b*d*n*x + 1/2*a^2*e*x^2 + 2*a*b*d*x*log(c) + a^2*d*x

Mupad [B] (verification not implemented)

Time = 0.40 (sec) , antiderivative size = 104, normalized size of antiderivative = 1.03 \[ \int (d+e x) \left (a+b \log \left (c x^n\right )\right )^2 \, dx=\ln \left (c\,x^n\right )\,\left (\frac {b\,e\,\left (2\,a-b\,n\right )\,x^2}{2}+2\,b\,d\,\left (a-b\,n\right )\,x\right )+{\ln \left (c\,x^n\right )}^2\,\left (\frac {e\,b^2\,x^2}{2}+d\,b^2\,x\right )+\frac {e\,x^2\,\left (2\,a^2-2\,a\,b\,n+b^2\,n^2\right )}{4}+d\,x\,\left (a^2-2\,a\,b\,n+2\,b^2\,n^2\right ) \]

[In]

int((a + b*log(c*x^n))^2*(d + e*x),x)

[Out]

log(c*x^n)*((b*e*x^2*(2*a - b*n))/2 + 2*b*d*x*(a - b*n)) + log(c*x^n)^2*((b^2*e*x^2)/2 + b^2*d*x) + (e*x^2*(2*
a^2 + b^2*n^2 - 2*a*b*n))/4 + d*x*(a^2 + 2*b^2*n^2 - 2*a*b*n)